import { ApiCall } from "tsrpc";
import { ReqMarkAllAsRead, ResMarkAllAsRead } from "../../../shared/protocols/masterServer/mail/PtlMarkAllAsRead";
import { DBMail } from "../../DBMail";
import { MasterServerConn } from "../../MasterServer";

export async function ApiMarkAllAsRead(call: ApiCall<ReqMarkAllAsRead, ResMarkAllAsRead>) {
    let req = call.req;
    let info = (call.conn as MasterServerConn).userInfo;
    let mails = DBMail.markAllAsRead(info.uid!);
    call.succ({mails:mails});
}